
#ifndef qf_port_h
#define qf_port_h

#include <raw_api.h>

#define QF_EQUEUE_TYPE              RAW_QUEUE
#define QF_THREAD_TYPE              RAW_TASK_OBJ

                 /* The maximum number of active objects in the application */
#define QF_MAX_ACTIVE               (CONFIG_RAW_PRIO_MAX - 2)

          /* uC/OS-II critical section operations (critical section type 3) */
//#define QF_CRIT_STAT_TYPE           
#define QF_CRIT_ENTRY(stat_)        RAW_CRITICAL_ENTER()
#define QF_CRIT_EXIT(stat_)         RAW_CRITICAL_EXIT()

#include "qep_port.h"     /* QEP port, includes the master uC/OS-II include */
#include "qequeue.h"          /* native QF event queue for deferring events */
#include "qf.h"                 /* QF platform-independent public interface */
#include "qmpool.h" 

/*****************************************************************************
* interface used only inside QF, but not in applications
*/
#if 0
typedef struct RAWOSMemPartTag {     
    MEM_POOL pool;                                
    QEvtSize block_size;                   
} RAWOSMemPartTag;

                                         
#define QF_EPOOL_TYPE_             RAWOSMemPartTag
#define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) do { \
    RAW_U16 err; \
    (p_).block_size = (evtSize_); \
	err = raw_block_pool_create(&((p_).pool), (RAW_U8  *)"block", (RAW_U32)(evtSize_), (poolSto_), (poolSize_));\
    Q_ASSERT(err == RAW_SUCCESS); \
} while (0)

#define QF_EPOOL_EVENT_SIZE_(p_)    ((p_).block_size)
#define QF_EPOOL_GET_(p_, e_) do { \
    RAW_U16 err; \
    err = raw_block_allocate&((p_).pool), &(e_), RAW_NO_WAIT);\
    Q_ASSERT(err == RAW_SUCCESS); \
} while (0)

#define QF_EPOOL_PUT_(p_, e_)       raw_block_release(&((p_).pool), (void *)(e_))
#endif

								/* native QF event pool operations */
#define QF_EPOOL_TYPE_				QMPool
#define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) \
	QMPool_init(&(p_), poolSto_, poolSize_, evtSize_)
#define QF_EPOOL_EVENT_SIZE_(p_)	((p_).blockSize)
#define QF_EPOOL_GET_(p_, e_)		((e_) = (QEvt *)QMPool_get(&(p_)))
#define QF_EPOOL_PUT_(p_, e_)		(QMPool_put(&(p_), e_))


#endif                                                         /* qf_port_h */
